﻿namespace Example.ServiceModel
{
    using System;
    using System.Diagnostics.CodeAnalysis;
    using System.ServiceModel;

    public static class Program
    {
        [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "This is the application entry point.")]
        public static void Main()
        {
            var proxy = new ServiceProxy("default");

            try
            {
                Console.WriteLine(proxy.GetSomething("hello").ToString());
            }
            catch (TimeoutException exception)
            {
                Console.WriteLine("Call timed out : {0}", exception.Message);
                proxy.Abort();
            }
            catch (CommunicationException exception)
            {
                Console.WriteLine("Call failed : {0}", exception.Message);
                proxy.Abort();
            }
            catch (Exception exception)
            {
                Console.WriteLine("Call failed : {0}", exception.Message);
                proxy.Abort();
            }

            Console.WriteLine("Press <ENTER> to terminate client.");
            Console.Read();
        }
    }
}